<template>
	<view>
		<page-head :title="'积分明细'" :headtype="2"></page-head>
		<view class="recoblock">
			<view class="recoitem blockbg marginAuto" v-for="(item,index) in rechdata" :key="index">
				<view class="recoiteml">
					<view class="recoiteml-title">{{ item.remark }}</view>
					<view class="recoiteml-time">{{ item.create_time }}</view>
				</view>
				<view class="recoitemr">{{ item.amount }}</view>
			</view>
		</view>
		<dataempty v-if="rechdata.length <= 0"></dataempty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				URLimg: this.URLimg,
				rechdata: [],
				page: 1
			};
		},
		onLoad() {
			this.initData();
		},
		methods: {
			initData() {
				let sendData = {
					page: this.page
				};
				this.apifun.unirequest('/api/User/integralRecord', 'post', sendData, (res) => {
					console.log(res)
					if (res.code === 200) {
						let datas = res.data;
						if (datas.data.data.length == 0) {
							return false
						};
						this.rechdata.push(...datas.data.data);
					} else {
						this.apifun.toast(res.msg)
					}
				})
			}
		},
		onReachBottom() {
			this.page++;
			this.initData();
		},
		onPullDownRefresh() {
			this.page = 1;
			this.rechdata = [];
			this.initData();
			uni.stopPullDownRefresh();
		},
	};
</script>

<style scoped lang="scss">
	page {
		padding-bottom: 150rpx;
	}

	.blockbg {
		width: 640rpx;
		border-radius: 20rpx;
		background-color: #fff;
		padding: 24rpx;
		margin-top: 20rpx;
	}

	.recoblock {
		padding-bottom: 20rpx;
		.recoitem {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;

			.recoiteml-title {
				font-size: 30rpx;
				color: #333333;
			}

			.recoiteml-time {
				font-size: 24rpx;
				color: #9E9E9E;
				line-height: 44rpx;
			}

			.recoitemr {
				margin-top: 18rpx;
				font-size: 40rpx;
				color: #333333;
			}
		}
	}
</style>